package com.example.kafka.controller;

import com.example.kafka.service.ProducerServiceAsyncSendWrong;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 反例 Controller：异步消息发送
 */
@RestController
@RequestMapping("/wrong/async")
public class ProducerControllerAsyncSendWrong {

    @Autowired
    private ProducerServiceAsyncSendWrong service;

    @PostMapping("/send")
    public String send(@RequestParam String topic, @RequestParam String message) {
        service.sendAsync(topic, message);
        return "异步消息已发送（反例）";
    }
}